// pages/product_detail/product_detail.js
const app = getApp()
Page({

  data: {
    coachProductInfo: [],
    img:''
  },

  onLoad: function (options) {
    let that = this
    wx.request({
      url: app.url + '/weiapp/Api/getCoachProductDetail',
      data:{
        coach_id : options.coach_id,
        product_id : options.product_id
      },
      success: function (res) {
        console.log(res)
        if (res.data.code != 200) {
          wx.showToast({
            title: '错误代码:' + res.data.code,
            icon: 'none',
            duration: 5000
          })
        }
        else {
          that.setData({
            coachProductInfo: res.data.data
          })
        }
      }
    })
  },

  nowBuyCurriculum(even)
  {
    wx.navigateTo({
      url: '../buy_curriculum/buy_curriculum?product_id=' + even.currentTarget.dataset.product_id + '&coach_id=' + even.currentTarget.dataset.coach_id
    })
  }

})